package com.eastfair.questionnaire.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.eastfair.core.base.entity.Entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.eastfair.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;
import com.eastfair.annotation.model.EchoVO;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 答案
 * </p>
 *
 * @author yuwx
 * @since 2021-09-04
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("q_answer")
@ApiModel(value = "Answer", description = "答案")
@AllArgsConstructor
public class Answer extends Entity<Long> implements EchoVO {

    private static final long serialVersionUID = 1L;
    @TableField(exist = false)
    private Map<String, Object> echoMap = new HashMap<>();
    /**
     * 项目ID
     */
    @ApiModelProperty(value = "项目ID")
    @TableField(value = "project_id")
    @Excel(name = "项目ID")
    private Long projectId;

    /**
     * 问题id
     */
    @ApiModelProperty(value = "问题id")
    @TableField(value = "question_id")
    @Excel(name = "问题id")
    private Long questionId;

    /**
     * 下一题id
     */
    @ApiModelProperty(value = "下一题id")
    @TableField(value = "next_question_id")
    @Excel(name = "下一题id")
    private Long nextQuestionId;

    /**
     * 上级答案
     */
    @ApiModelProperty(value = "上级答案")
    @TableField(value = "parent_answer_id")
    @Excel(name = "上级答案")
    private Long parentAnswerId;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @TableField(value = "sequence")
    @Excel(name = "排序")
    private Integer sequence;

    /**
     * 问题名称
     */
    @ApiModelProperty(value = "问题名称")
    @Size(max = 128, message = "问题名称长度不能超过128")
    @TableField(value = "name", condition = LIKE)
    @Excel(name = "问题名称")
    private String name;

    /**
     * 问题英文名称
     */
    @ApiModelProperty(value = "问题英文名称")
    @Size(max = 128, message = "问题英文名称长度不能超过128")
    @TableField(value = "en_name", condition = LIKE)
    @Excel(name = "问题英文名称")
    private String enName;

    /**
     * 问题别名
     */
    @ApiModelProperty(value = "问题别名")
    @Size(max = 128, message = "问题别名长度不能超过128")
    @TableField(value = "alias_name", condition = LIKE)
    @Excel(name = "问题别名")
    private String aliasName;

    /**
     * 问题英文别名
     */
    @ApiModelProperty(value = "问题英文别名")
    @Size(max = 128, message = "问题英文别名长度不能超过128")
    @TableField(value = "en_alias_name", condition = LIKE)
    @Excel(name = "问题英文别名")
    private String enAliasName;

    /**
     * 提示语
     */
    @ApiModelProperty(value = "提示语")
    @Size(max = 128, message = "提示语长度不能超过128")
    @TableField(value = "default_tip", condition = LIKE)
    @Excel(name = "提示语")
    private String defaultTip;

    /**
     * 图标地址
     */
    @ApiModelProperty(value = "图标地址")
    @Size(max = 255, message = "图标地址长度不能超过255")
    @TableField(value = "icon_url", condition = LIKE)
    @Excel(name = "图标地址")
    private String iconUrl;

    /**
     * 末级节点
     */
    @ApiModelProperty(value = "末级节点")
    @TableField(value = "is_leaf")
    @Excel(name = "末级节点")
    private Integer isLeaf;

    /**
     * 允许输入
     */
    @ApiModelProperty(value = "允许输入")
    @TableField(value = "is_input")
    @Excel(name = "允许输入")
    private Integer isInput;

    /**
     * 是否生效(默认1：可用 0:不可用)
     */
    @ApiModelProperty(value = "是否生效(默认1：可用 0:不可用)")
    @TableField(value = "is_enable")
    @Excel(name = "是否生效(默认1：可用 0:不可用)")
    private Integer isEnable;

    /**
     * 是否删除(默认0：未删除 1:已删除)
     */
    @ApiModelProperty(value = "是否删除(默认0：未删除 1:已删除)")
    @TableField(value = "is_delete")
    @Excel(name = "是否删除(默认0：未删除 1:已删除)")
    private Integer isDelete;


    @Builder
    public Answer(Long id, Long createdBy, LocalDateTime createTime, Long updatedBy, LocalDateTime updateTime, 
                    Long projectId, Long questionId, Long nextQuestionId, Long parentAnswerId, Integer sequence, 
                    String name, String enName, String aliasName, String enAliasName, String defaultTip, String iconUrl, 
                    Integer isLeaf, Integer isInput, Integer isEnable, Integer isDelete) {
        this.id = id;
        this.createdBy = createdBy;
        this.createTime = createTime;
        this.updatedBy = updatedBy;
        this.updateTime = updateTime;
        this.projectId = projectId;
        this.questionId = questionId;
        this.nextQuestionId = nextQuestionId;
        this.parentAnswerId = parentAnswerId;
        this.sequence = sequence;
        this.name = name;
        this.enName = enName;
        this.aliasName = aliasName;
        this.enAliasName = enAliasName;
        this.defaultTip = defaultTip;
        this.iconUrl = iconUrl;
        this.isLeaf = isLeaf;
        this.isInput = isInput;
        this.isEnable = isEnable;
        this.isDelete = isDelete;
    }

}
